package com.zhiwang.xiaoqu.ui.coupon

import android.graphics.Color
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.zhiwang.xiaoqu.R
import com.zhiwang.xiaoqu.ktextension.setImmersive
import com.zhiwang.xiaoqu.ui.BaseListActivity

class CouponListActivity : BaseListActivity<CouponListActivity.Coupon, CouponListActivity.CouponViewHolder>() {

    data class Coupon(var type: Int, var num: String)


    override fun onCreate(savedInstanceState: Bundle?) {
        window.setImmersive(Color.TRANSPARENT, true)
        super.onCreate(savedInstanceState)

//        mock()
    }

    private fun mock() {
        val list = arrayListOf<Coupon>()
        for (i in 0 until 34)
            list.add(Coupon(i % 3, "$i"))

        window.decorView.postDelayed({
            onLoadMoreData(list)
        }, 250)
    }


    override fun startLoadMore() {
        mock()
    }

    override fun startRefresh() {

        stopRefresh()
    }

    override fun getEmptyLayoutRes() = R.layout.coupon_empty_layout

    override fun getLayoutRes() = R.layout.item_coupon

    override fun getToolBarTitle() = "我的卡包"

    override fun whenBindViewHolder(holder: CouponViewHolder, item: Coupon?) {

    }

    override fun getHeaderLayoutRes() = R.layout.dummy_header_layout


    class CouponViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {


    }
}
